package com.chen.single;

// 饿汉式单例
public class Hungry {

    // 饿汉太饿了，一加载类就创建了对象
    private final static Hungry HUNGRY = new Hungry();

    // 单例模式的特点是构造器私有
    private Hungry() {}

    private static Hungry getInstance() {
        return HUNGRY;
    }

    // 可能会浪费空间
    private byte[] data1 = new byte[1024 * 1024];
    private byte[] data2 = new byte[1024 * 1024];
    private byte[] data3 = new byte[1024 * 1024];
    private byte[] data4 = new byte[1024 * 1024];

}
